﻿using System;

namespace Moon.Sql
{
    /// <summary>
    /// 数据库中Function
    /// </summary>
    public partial class DbFunc
    {
        public static TResult Sum<TResult>(object val) { return default(TResult); }
        public static TResult Max<TResult>(object val) { return default(TResult); }
        public static TResult Min<TResult>(object val) { return default(TResult); }
        public static TResult Avg<TResult>(object val) { return default(TResult); }
        public static TResult Count<TResult>(object val) { return default(TResult); }
        public static TResult DistinctCount<TResult>(object val) { return default(TResult); }
        public static int Datediff_Year(DateTime field, DateTime date) { return 0; }
        public static int Datediff_Month(DateTime field, DateTime date) { return 0; }
        public static int Datediff_Day(DateTime field, DateTime date) { return 0; }
        public static int Datediff_Hour(DateTime field, DateTime date) { return 0; }
        public static int Datediff_Hour(DateTime field, string date) { return 0; }
        public static TResult IsNull<TResult>(object field, TResult val) { return default(TResult); }
        public static string Sequence(string name) { return null; }
        public static string Custom(string val) { return null; }
        public static string PartitionBy(object partitionByField, object orderByField, Moon.Sql.OrderBy orderBy = OrderBy.Asc) { return null; }
        public static TResult ToDateFormat<TResult>(object field, string style) { return default(TResult); }
    }

    #region Func
    public class MoonFunc<T1, T2>
    {
        public MoonFunc(T1 t1, T2 t2)
        {
            this.t1 = t1;
            this.t2 = t2;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
    }

    public class MoonFunc<T1, T2, T3>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4, T5>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
            this.t5 = t5;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
        public T5 t5 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4, T5, T6>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
            this.t5 = t5;
            this.t6 = t6;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
        public T5 t5 { get; }
        public T6 t6 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4, T5, T6, T7>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
            this.t5 = t5;
            this.t6 = t6;
            this.t7 = t7;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
        public T5 t5 { get; }
        public T6 t6 { get; }
        public T7 t7 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4, T5, T6, T7, T8>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
            this.t5 = t5;
            this.t6 = t6;
            this.t7 = t7;
            this.t8 = t8;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
        public T5 t5 { get; }
        public T6 t6 { get; }
        public T7 t7 { get; }
        public T8 t8 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
            this.t5 = t5;
            this.t6 = t6;
            this.t7 = t7;
            this.t8 = t8;
            this.t9 = t9;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
        public T5 t5 { get; }
        public T6 t6 { get; }
        public T7 t7 { get; }
        public T8 t8 { get; }
        public T9 t9 { get; }
    }

    public class MoonFunc<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
    {
        public MoonFunc(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10)
        {
            this.t1 = t1;
            this.t2 = t2;
            this.t3 = t3;
            this.t4 = t4;
            this.t5 = t5;
            this.t6 = t6;
            this.t7 = t7;
            this.t8 = t8;
            this.t9 = t9;
            this.t10 = t10;
        }

        public T1 t1 { get; }
        public T2 t2 { get; }
        public T3 t3 { get; }
        public T4 t4 { get; }
        public T5 t5 { get; }
        public T6 t6 { get; }
        public T7 t7 { get; }
        public T8 t8 { get; }
        public T9 t9 { get; }
        public T10 t10 { get; }
    }
    #endregion Func

    public enum DatabaseType
    {
        SqlServer,
        MySql,
        Oracle
    }
    
    public struct MySqlDb { }
    public struct SqlServerDb { }
    public struct OracleDb { }

    public enum OrderBy
    {
        Asc,
        Desc
    }
}
